home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / Rsrc Compare by Procedure / Rsrc Compare Proc.r < prev    next >
Encoding:
Text File  |  1994-11-15  |  3.4 KB  |  115 lines  |  [TEXT/MPS ]

  1. //
  2. //    "Rsrc Compare Proc.r"
  3. //
  4. //  This script is set up to use a custom version proc to determine whether
  5. //  or not to replace/update an existing resource.
  6. //  This is the recommended way of determining whether or not to update an
  7. //  existing resource which has a version number somewhere in the resource header.
  8.  
  9. //  If the correct flags are set, Installer will call the custom proc, which should
  10. //  use the call back routine ReadTargetData to obtain the resource version.
  11.  
  12. //  The following flags must be set:
  13. //        copy, leaveAloneIfNewer, & update existing.
  14. //  also the 'inra' must have the source version hard-coded.
  15.  
  16. //    In this example, the resource will be copied the first time only.  
  17. //    The update will NOT happen, since the custom proc will return the 
  18. //    first long of the resource, which is “0x21110000”, and
  19. //    the version in the 'inra' below is “0x2110ffff”.
  20.  
  21. #include "InstallerTypes.r"
  22.  
  23. include "GetRsrcVersion";
  24.  
  25. resource 'inpk' (100) {
  26.     format0 {
  27.         showsOnCustom,
  28.         removable,
  29.         dontForceRestart,
  30.         0,
  31.         0,
  32.         "Copy File Read Me from Tidbits Disk....",
  33.         {    'inra', 1000    },
  34.         }
  35.     };
  36.  
  37. resource 'inra' (1000) {
  38.     format1 {
  39.         deleteWhenRemoving,
  40.         deleteWhenInstalling,
  41.         copy,                            //  Copy on Install
  42.         leaveAloneIfNewer,                //  Do not update a newer file
  43.         noTgtRequired,
  44.         updateExisting,                    //  Update an existing file
  45.         copyIfNewOrUpdate,
  46.         ignoreProtection,
  47.         srcNeedExist,
  48.         byID,
  49.         nameNeedNotMatch,
  50.         0,
  51.         10000,
  52.         'PICT',
  53.         1000,
  54.         0x0,
  55.         "Fubar Pict",
  56.         {    20000, 'PICT', 1000, 0, "WhatEver"    },
  57.         0x2110ffff,                        //  The “dummy” source version number (first long from resource)
  58.         128,                            //  MUST be the 'invc' id of the custom version proc
  59.         0,
  60.         "Read Me - PICT"
  61.         }
  62.     };
  63.  
  64. resource 'invc' (128) {
  65.     format0 {
  66.         'infn',                            //  The resource type of the actual custom proc
  67.         128,                            //  The resource id of the actual custom proc
  68.         1024,                            //  The minimum amount of memory needed by the proc
  69.         "Returns the first long from the target resource.",        //  Will return “0x21110000”
  70.         }
  71.     };
  72.  
  73. // NOTE: When a target spec is called from within a resource atom of
  74. // any kind ( 'inra', 'inrm', 'inr#' ), the type, creator, dates and
  75. // Finder attributes fields will only apply when creating a new file.
  76. resource 'intf' (10000) {
  77.     format1 {
  78.         noSearchForFile,                 // use default search path
  79.         
  80.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  81.                                         // then a file with a different type
  82.                                         // and creator than those specified
  83.                                         // below will not be updated.
  84.                                         // If this is set to TypeCrNeedNotMatch
  85.                                         // then type and creator of an existing
  86.                                         // target file are ignored.
  87.         
  88.         // The Type and Creator fields will be used to set the
  89.         // file's Type and Creator when a new file is created. 
  90.         'rsrc',                         // TYPE for new file
  91.         'RSED',                         // CREATOR for new file
  92.         
  93.         0,                                 // finder attribute flags
  94.                                         // filled by ScriptCheck is value is 0
  95.         
  96.         1,                                  // creation date for new file
  97.         1,                                  // modification date for new file
  98.                                         // NOTE: DATE values are filled
  99.                                         // by ScriptCheck if the value is 1
  100.                                             
  101.         0,                                 // search proc ID ( 'insp' ), none used
  102.         
  103.         ":Read Me - PICT"                // path to target file
  104.         }
  105.     };
  106.  
  107. resource 'infs' (20000) {
  108.     'ttro',
  109.     'ttxt',
  110.     0x1,                            //  Thu, Apr 25, 1991     12:00:00 PM
  111.     noSearchForFile,
  112.     TypeCrMustMatch,
  113.     "Tidbits:Apple Utilities:Read Me"    //  System 7.1 Tidbits FDHD diskette
  114.     };
  115.